<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="__PUBLIC_ADMIN__/Css/public.css">
    <link rel="stylesheet" href="__PUBLIC_ADMIN__/Css/node.css">
    <script src="__PUBLIC__/Js/jquery-1.7.2.min.js"></script>
    <script src="__PUBLIC__/layer/layer.js"></script>
    <script>
        $(function(){
            $('input[level=1]').click(function(){
                var inputs=$(this).parents('.app').find('input');
                $(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');
            });

            $('input[level=2]').click(function(){
                var inputs=$(this).parents('dl').find('input');
                $(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');
            })
        })
    </script>
</head>
<body>
<form action="{:U('Index/setAccess')}" method="post">
    <div id="wrap">
        <a href="{:U('Index/role')}" class="add-app">返回</a>

        <foreach name="list" item="vo">
            <div class="app">
                <p>
                    <strong>{$vo.title}</strong>
                    <input type="checkbox" name="access[]" value="{$vo.id}_1" level="1" <if condition="$vo['access']">checked='checked'</if>/>
                </p>
                <foreach name="vo.child" item="action">
                    <dl>
                        <dt>
                            <strong>{$action.title}</strong>
                            <input type="checkbox" name="access[]" value="{$action.id}_2" level="2" <if condition="$action['access']">checked='checked'</if>/>
                        </dt>
                        <foreach name="action.child" item="method">
                            <dd>
                                <span>{$method.title}</span>
                                <input type="checkbox" name="access[]" value="{$method.id}_3" level="3" <if condition="$method['access']">checked='checked'</if> />
                            </dd>
                        </foreach>
                    </dl>
                </foreach>
            </div>
        </foreach>
    </div>
    <input type="hidden" name="rid" value="{$rid}">
    <input type="submit" value="提交" style="display: block;margin: 20px auto">
</form>
</body>
</html>